package com.originskyseed.platform.cms.service.impl;

import java.util.List;
import java.util.Map;

import javax.annotation.Resource;

import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.stereotype.Component;

import com.originskyseed.platform.cms.mapper.CmsContentListMapper;
import com.originskyseed.platform.cms.service.ICmsContentListService;
import com.originskyseed.platform.cms.vo.CmsContentListVO;
import com.originskyseed.platform.cms.vo.InformationListVO;
import com.originskyseed.platform.core.base.BasePage;

/**
 * 信息查询接口实现类
 *
 * @author TangWangHui
 *
 */
@DubboService
@Component("cmsContentListService")
public class CmsContentListServiceImpl implements ICmsContentListService {

	@Resource
	private CmsContentListMapper cmsContentListMapper;

	/**
	 * 按条件分页查询内容 selectCmsContentListByPage
	 * 
	 * @param params
	 * @param page
	 * @return
	 * @throws Exception
	 */
	@Override
	public BasePage<InformationListVO> selectCmsContentListByPage(Map<String, Object> params, BasePage<InformationListVO> page) throws Exception {

		params.put("page", page);
		List<InformationListVO> list = this.cmsContentListMapper.selectCmsContentListByPage(params);
		page.setResults(list);
		return page;
	}

	/**
	 * 按条件查询内容 selectCmsContentListByPage
	 * 
	 * @param params
	 * @return
	 * @throws Exception
	 */
	@Override
	public List<InformationListVO> selectCmsContentList(Map<String, Object> params) throws Exception {
		return this.cmsContentListMapper.selectCmsContentList(params);
	}

	/**
	 * 查询消息公告、热门推荐
	 *
	 * @param params
	 * @return
	 * @throws Exception
	 */
	public List<Map<String, Object>> selectNoticeOrRecommend(Map<String, Object> params) throws Exception {
		return this.cmsContentListMapper.selectNoticeOrRecommend(params);
	}

	/**
	 * 根据id查询内容 selectCmsContentById
	 * 
	 * @param contentId
	 * @return
	 * @throws Exception
	 */
	@Override
	public CmsContentListVO selectCmsContentById(String contentId) throws Exception {
		return cmsContentListMapper.selectCmsContentById(contentId);
	}

	/**
	 * 查询所有内容 selectCmsContentAll
	 *
	 * @return
	 * @throws Exception
	 */
	@Override
	public List<CmsContentListVO> selectCmsContentAll() throws Exception {
		return cmsContentListMapper.selectCmsContentAll();
	}

}
